package com.cap.dreamcircle.Model.Impl;

import com.cap.dreamcircle.Api.FriendService;
import com.cap.dreamcircle.Model.Bean.BaseBean;
import com.cap.dreamcircle.Model.Bean.FellowFansForbiddenBean;
import com.cap.dreamcircle.Model.IFriendModel;
import com.cap.dreamcircle.Utils.ServiceFactory;
import com.cap.dreamcircle.Utils.TransformUtils;

import java.util.HashMap;

import rx.Observable;

/**
 * Created by liucxu on 2017/10/17.
 */

public class FriendModelImpl implements IFriendModel {

    @Override
    public Observable<FellowFansForbiddenBean> requestMyFollows() {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","myFollows");
        return ServiceFactory.GetInstance().createService(FriendService.class).requestMyFollows(params).compose(TransformUtils.<FellowFansForbiddenBean>defaultSchedulers());
    }

    @Override
    public Observable<FellowFansForbiddenBean> requestMyFans() {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","myFans");
        return ServiceFactory.GetInstance().createService(FriendService.class).requestMyFans(params).compose(TransformUtils.<FellowFansForbiddenBean>defaultSchedulers());
    }

    @Override
    public Observable<FellowFansForbiddenBean> requestForbiddenUsers() {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","myBlocks");
        return ServiceFactory.GetInstance().createService(FriendService.class).requestForbiddenUsers(params).compose(TransformUtils.<FellowFansForbiddenBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseBean> fellow(String toUserId) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","follow");
        params.put("toUserId",toUserId);
        return ServiceFactory.GetInstance().createService(FriendService.class).fellow(params).compose(TransformUtils.<BaseBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseBean> disFellow(String toUserId) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","disFollow");
        params.put("toUserId",toUserId);
        return ServiceFactory.GetInstance().createService(FriendService.class).disFellow(params).compose(TransformUtils.<BaseBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseBean> forbiddenUser(String toUserId) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","block");
        params.put("toUserId",toUserId);
        return ServiceFactory.GetInstance().createService(FriendService.class).forbiddenUser(params).compose(TransformUtils.<BaseBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseBean> disForbiddenUser(String toUserId) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","disBlock");
        params.put("toUserId",toUserId);
        return ServiceFactory.GetInstance().createService(FriendService.class).disForbiddenUser(params).compose(TransformUtils.<BaseBean>defaultSchedulers());
    }
}
